<?php
    #-------------------------------------------------------------#
	# This file is part of the Kumomado - Virtual Window Platform #
	# for PHP. (c) 2009 Tsai, Min Che <tirme0812@gmail.com>       #
	# Please visit http://www.kumomado.org/ for more information. #
	#                                                             #
	# This software is licensed under the GNU License v3. Please  #
	# view the LICENSE file for the full text of this license.    #
    #-------------------------------------------------------------#

	Kumomado::load('Kui.Components.Base.KumomadoUIBase');
	/**
	 * @package libraries/kui/components/base/
	 * @author Tsai, Min Che
	 * @version 1.0
	 */
	class KumomadoTextArea extends KumomadoUIBase {
		protected $ui_name = 'KTextarea';
		protected $value;
		protected $rows = 5;
		protected $cols = 20;
		public function __construct($id, $value = null) {
			$this->setId($id);
			$this->setValue($value);
		}
		public function setValue($value) {
			$this->value = $value;
		}
		public function getValue() {
			return $this->value;
		}
		public function setRows($rows) {
			$this->rows = intval($rows);
		}
		public function getRows() {
			return $this->rows;
		}
		public function getCols() {
			return $this->cols;
		}
		public function setCols($cols) {
			$this->cols = intval($cols);
		}
		public function getAttrs() {
			return array(
				'id' => $this->getId(),
				'rows' => $this->rows,
				'cols' => $this->cols
			);
		}
		public function view() {
			$view = '<textarea id="'.$this->getId().'" name="'.$this->getId().'" rows="'.$this->rows.'" cols="'.$this->cols.'">'.$this->getValue().'</textarea>';
			return $view;
		}
		public function render() {
			return array(
				'ui_name' => $this->ui_name,
				'attrs' => $this->getAttrs(),
				'view' => $this->view()
			);
		}
	}
?>